﻿namespace AppLibrary
{
    using System;
    using System.IO;
    using System.ServiceModel;
    using System.ServiceModel.Syndication;
    using System.ServiceModel.Web;
    using System.Xml;

    [ServiceContract]
    public interface IAtomPub
    {
        [WebGet(UriTemplate = "/")]
        [OperationContract]
        XmlElement ServiceDocument();

        [WebGet(UriTemplate = "/{resource}/entries")]
        [OperationContract]
        SyndicationFeed GetEntries(String resource);

        [WebInvoke(Method = "POST", UriTemplate = "/{resource}/entries")]
        [OperationContract]
        SyndicationItem CreateEntry(String resource, SyndicationItem entry);

        [WebGet(UriTemplate = "/{resource}/entries/{entryId}")]
        [OperationContract]
        SyndicationItem GetEntry(String resource, String entryId);

        [WebInvoke(Method = "PUT", UriTemplate = "/{resource}/entries/{entryId}")]
        [OperationContract]
        SyndicationItem UpdateEntry(String resource, String entryId, SyndicationItem entry);

        [WebInvoke(Method = "DELETE", UriTemplate = "/{resource}/entries/{entryId}")]
        [OperationContract]
        void DeleteEntry(String resource, String entryId);

        [WebInvoke(Method = "POST", UriTemplate = "/{resource}/entries/content")]
        [OperationContract]
        SyndicationItem CreateEntryContent(String resource, Stream content);

        [WebGet(UriTemplate = "/{resource}/entries/{entryId}/content")]
        [OperationContract]
        Stream GetEntryContent(String resource, String entryId);

        [WebInvoke(Method = "PUT", UriTemplate = "/{resource}/entries/{entryId}/content")]
        [OperationContract]
        SyndicationItem UpdateEntryContent(String resource, String entryId, Stream content);

        [WebInvoke(Method = "DELETE", UriTemplate = "/{resource}/entries/{entryId}/content")]
        [OperationContract]
        void DeleteEntryContent(String resource, String entryId);
    }
}
